#pragma once

#include "Neuron.h"
#include "NeuronInputValue.h"

#include <vector>

using std::vector;

class Perceptron
{
private:
	vector<Neuron*> _layerInput;
	vector<Neuron*> _layerHidden;
	vector<Neuron*> _layerOutput;
	vector<NeuronInputValue*> _inputValues;
	vector<NeuronInputValue*> _biasValues;

	double RandomWeight();
	Neuron* CreateNeuron(NeuronActivationFunctionType activationFunctionType);
	void DeleteNeuron(Neuron* pNeuron);
	vector<Neuron*>* SelectLayer(unsigned int layerIndex);

public:
	Perceptron();
	~Perceptron();

	void Clear();

	void SetInputLayer(unsigned int numNeurons, NeuronActivationFunctionType activationFunctionType);
	void SetHiddenLayer(unsigned int numNeurons, NeuronActivationFunctionType activationFunctionType);
	void SetOutputLayer(unsigned int numNeurons, NeuronActivationFunctionType activationFunctionType);

	void SetBiasValue(double value); 

	void SetInputValues(vector<double> inputValues); 
	vector<double> CountOutputValues(unsigned int layerIndex = 2);

	bool Learn(vector<double> expectedValues, double learnFactor, double momentum);

	double GetWeight(unsigned int layerIndex, unsigned int neuronIndex, unsigned int inputIndex);
};
